# koroFileHeader at Home PC
# Create: 2021-01-02 16:57:43
# LastEdit: 2021-01-02 17:14:42
"""https://leetcode-cn.com/problems/implement-strstr/"""
__author__ = '749B'


class Solution:
    def strStr(self, haystack: str, needle: str) -> int:
        l1 = len(haystack)
        l2 = len(needle)
        for i in range(l1 - l2 + 1):
            if haystack[i:i + l2] == needle:
                return i
        return -1
        